﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using ViewModelInViewModel.Models;

namespace ViewModelInViewModel.ViewModels;

public class InnerViewModel : ObservableObject {
    private readonly MainPageViewModel _mainPageViewModel;

    public InnerViewModel(MainPageViewModel mainPageViewModel) {
        _mainPageViewModel = mainPageViewModel ??
            throw new ArgumentNullException(nameof(mainPageViewModel));
    }

    private RelayCommand _deleteCommand;

    public RelayCommand DeleteCommand =>
        _deleteCommand ??= new RelayCommand(() =>
            _mainPageViewModel.RemoveInnerViewModel(this));

    private Poetry _poetry;

    public Poetry Poetry {
        get => _poetry;
        set => SetProperty(ref _poetry, value);
    }
}